<script lang="ts" setup>
import {selectConfigByCache} from "@/api/system/orgConfig.ts";
import {useUserStoreHook} from "@/store/modules/user.ts";

const {proxy} = getCurrentInstance() as any
const iframeUrl = ref("http://localhost:8699/#/")
const useUserStore = useUserStoreHook();
// 登录用户信息
const userInfo = <UserInfoBusi>useUserStore.user.userInfo;
const reportUrlInfo = ref({
  ip: "",
  port: "",
  suffix: ""
})

const url = ref("http://")

function getUrlInfo() {
  /**
   * 通过orgId key获取对应的机构参
   */
  selectConfigByCache(userInfo.orgId, "report.url.info").then((res => {
    reportUrlInfo.value = res.data
    url.value += reportUrlInfo.value.ip + ':' + reportUrlInfo.value.port
    iframeUrl.value = url.value + "/#/"
  }))
}


getUrlInfo()
</script>

<script lang="ts">
export default {
  name: "Designer",
}
</script>
<template>
  <div class="app-container">
    <div class="iframe">
      <!--iframeUrl 需要内嵌展示的url 传值可以直接拼接在路径后 如：https://xxx.com?data='需要传的参数'-->
      <iframe id="iframe" :src="iframeUrl" frameborder="0" style="width:100%; height: 100%;"></iframe>
    </div>
  </div>

</template>

<style scoped>

.iframe {
  height: 100%;
}

</style>
